package cn.doitedu.other;


import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.io.FilenameFilter;

public class FileNameUtil {
    public static void main(String[] args) {
        String dirPath = "F:\\00000000000---多易视频备份\\DOIT18视频\\doit18-kafka-day04\\" ;
        int base = 23;
        File dir = new File(dirPath);
        File[] mp4s = dir.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {


                return name.endsWith("mp4");
            }
        });

        for (File f : mp4s) {
            String[] split = f.getName().split("\\.");
            int i = Integer.parseInt(split[0]);
            int num = i+base;
            String s = StringUtils.leftPad(num+"", 2, "0");

            String newName = dirPath+s+"."+split[1]+".mp4";
            System.out.println(newName);
            f.renameTo(new File(newName));
        }
    }
}
